var mysql = require('mysql');

var connection = mysql.createConnection({
	host: 'localhost',
	port: 3306,
	database: 'test',
	user: 'root',
	password: '123456'
});

connection.connect(function(err){
	if(err) 
		console.log('连接失败');
	else{
		console.log('连接成功');
		connection.end(function(err){
			if(err)
				console.log('关闭失败');
			else
				console.log('关闭成功');
		})
	}
});